package com.wss.common.utils.toast.style;

import com.wss.common.utils.PxUtils;
import com.wss.common.utils.toast.IToastStyle;
import ohos.agp.utils.LayoutAlignment;
import ohos.app.Context;

/**
 * github : https://github.com/getActivity/ToastUtils
 * time   : 2019/05/19
 * desc   : 默认样式基类
 */
public abstract class BaseToastStyle implements IToastStyle {

    private Context mContext;

    public BaseToastStyle(Context context) {
        mContext = context;
    }

    @Override
    public int getGravity() {
        return LayoutAlignment.CENTER;
    }

    @Override
    public int getXOffset() {
        return 0;
    }

    @Override
    public int getYOffset() {
        return 0;
    }

    @Override
    public int getZ() {
        return 30;
    }

    @Override
    public int getMaxLines() {
        return 5;
    }

    @Override
    public int getPaddingEnd() {
        return getPaddingStart();
    }

    @Override
    public int getPaddingBottom() {
        return getPaddingTop();
    }

    /**
     * dp转px
     */
    protected int vp2px(float vpValue) {
        return PxUtils.vp2px(vpValue);
    }

    /**
     * sp转px
     */
    protected int fp2px(float fpValue) {
        return PxUtils.fp2px(fpValue);
    }
}